package cn.tedu.store.temperatureDetection.controller;

import cn.tedu.store.common.ApiResult;
import cn.tedu.store.temperatureDetection.entity.EmployeeTemperature;
import cn.tedu.store.temperatureDetection.service.EmployeeTemperatureService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 75936
 * @version 1.0
 * @project demo_hesuan
 * @description
 * @date 2022-11-28 19:32:08
 */
@RestController
@RequestMapping("/EmployeeTemperature")
public class EmployeeTemperatureController {

    @Autowired
    private EmployeeTemperatureService employeeTemperatureService;

    @PostMapping("addEmployeeTemperature")
    public ApiResult addEmployeeTemperature(EmployeeTemperature employeeTemperature){
        employeeTemperatureService.addEmployeeTemperature(employeeTemperature);
        return  ApiResult.ok();
    }

    /**查询本人的温度检测记录*/
    @GetMapping("findCount")
    public ApiResult findCount(@RequestParam("emplCode")String emplCode,
                                @RequestParam("emplName")String  emplName){
        return ApiResult.ok(employeeTemperatureService.findCount(emplCode,emplName));
    }


    @GetMapping("findEmployee")
    public ApiResult findEmployee(@RequestParam("emplCode")String emplCode,
                                  @RequestParam("emplName")String  emplName){
        return ApiResult.ok(employeeTemperatureService.findEmployee(emplCode,emplName));
    }


}
